<#include "include/_meta.html">
<html>
<head>
    <title>管理员列表</title>

</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 车辆管理<span class="c-gray en">&gt;</span> 车辆保险记录列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div id="app" class="container">
    <form class="form-inline bg-danger" role="form">
        <div class="form-group">
            <label class="sr-only" for="carid">车辆编号</label>
            <input type="text" class="form-control" id="carid" name="carid" placeholder="车辆编号">
        </div>
        <button type="button" id="cardd" class="btn btn-danger">查询</button>
        <button type="button" id="addUser" class="btn btn-danger">增加信息</button>

    </form>
    <div class="table-responsive">
        <table class="table">
            <tr class="success">
                <th>记录编号</th>
                <th>车辆编号</th>
                <th>发车里程</th>
                <th>发车油量</th>
                <th>保养地点</th>
                <th>出车时间</th>
                <th>经办人员</th>
                <th>经办手机</th>
                <th>还车时间</th>
                <th>还车里程</th>
                <th>还车油量</th>
                <th>保养费用</th>
                <th>保养内容</th>
                <th>备注信息</th>
                <th>下次保养时间</th>
                <th>下次保养里程</th>
                <th>默认为系统时间</th>
                <th>操作</th>
            </tr>
            <tr class="active" v-for="item in result" :value="item.recordid" >
                <td>{{item.recordid}}</td>
                <td>{{item.carid}}</td>
                <td>{{item.initmile}}</td>
                <td>{{item.initoil}}</td>
                <td>{{item.address}}</td>
                <td>{{item.usecartime}}</td>
                <td>{{item.headman}}</td>
                <td>{{item.headmobile}}</td>
                <td>{{item.returntime}}</td>
                <td>{{item.returnmile}}</td>
                <td>{{item.returnoil}}</td>
                <td>{{item.costmoney}}</td>
                <td>{{item.costcontent}}</td>
                <td>{{item.remark}}</td>
                <td>{{item.nexttime}}</td>
                <td>{{item.nextmile}}</td>
                <td>{{item.addtime}}</td>
                <td>
                    <button type="button" @click="editEvent(item.recordid)">修改</button>
                    <button type="button" @click="delEvent(item.recordid)">删除</button></td>
            </tr>
            <tr>
                <td colspan="3">
                    <div id="pagenav"></div>
                </td>
            </tr>
        </table>
    </div>
</div>

<#include "include/_footer.html">
<script>
    var app = new Vue({
        el: '#app',
        data: {
            result: []
        }
    });
    var getCarInsuPagelist=function (curr) {
        console.log($("#carid").val())
        $.ajax({
            type: 'POST',
            dataType: 'json',
            url: '/maints/getPages',
            data: {
                pageNum: curr || 1,
                pageSize: 10,
                carid:$("#carid").val()
            },
            success: function (msg) {
                app.result = msg.page;
                console.log(msg);
                app.result = msg.page;
                laypage({
                    cont: "pagenav",
                    pages: msg.totalPage,
                    skin: "#DB7023",
                    first: "首页",
                    last: "最后一页",
                    curr: curr || 1,
                    jump: function (obj, first) {
                        if (!first) {
                            getCarInsuPagelist(obj.curr);
                        }
                    }
                });
            }
        });
    }
    getCarInsuPagelist();
    $("#cardd").click(function () {
        getCarInsuPagelist();
    })
    var editEvent=function (recordid) {
        layer.open({
            type:2,
            title:"修改用户信息",
            fix:false,
            maxmin:true,
            shadeClose:true,
            area:['1000px','800px'],
            content:"/maints/edit?recordid="+recordid,
            end:function () {
                getCarInsuPagelist();
            }
        })
    }
    var delEvent=function (recordid) {
        //del框
        layer.confirm('是否删除',{btn:['是','否']},function () {
            $.ajax({
                type:"POST",
                dataType:"json",
                url:"/maints/del",
                data:{
                    recordid:recordid
                },
                success:function (msg) {
                    layer.msg('已删除!',{icon: 5,time:1000});
                    getCarInsuPagelist();
                }
            });
        },function () {

        })
    }
    $("#addUser").on("click",function () {
        layer.open({
            type:2,
            title:"添加",
            fix:false,
            maxmin:true,
            shadeClose:true,
            area:['1000px','800px'],
            content:"/maints/add",
            end:function () {
                getCarInsuPagelist();
            }
        })
    })
</script>
</body>
</html>